function fit = modelFit(model,x2,t)
% The fitted values from the model
if model.modelNum == 1 
    %QTSM without interest rate smoothing
    if model.factorSignResOn == 1
        x = [model.macros(t,:)';exp(x2(1:model.nm,1));x2(model.nm+1:end,1)];
    else
        x = [model.macros(t,:)';x2];    
    end
    fit = model.g0 + model.gx*x + model.gxx*kron(x,x);
elseif model.modelNum == 2
    %QTSM with constant interest rate smoothing
    if model.factorSignResOn == 1
        x = [model.macros(t,:)';exp(x2(1:model.nm,1));x2(model.nm+1:end,1)];
    else
        x = [model.macros(t,:)';x2];
    end
    fit = model.g0 + model.rhor*model.rLag(t,1) + model.gx*x + model.gxx*kron(x,x);
end

